package cn.kzgg.ymcc.feign;

import cn.kzgg.ymcc.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class MediaFileFeignClientFallbackFactory implements FallbackFactory<MediaFileFeignClient> {
    @Override
    public MediaFileFeignClient create(Throwable throwable) {
        return new MediaFileFeignClient() {
            @Override
            public JSONResult courseDetail(Long chapterId) {
                throwable.printStackTrace();
                return JSONResult.error("media服务不可达");
            }
        };
    }
}
